<script>
export default {
  name: 'Test_Component',
  data() {
    return {
      isShow: true,
      showClass: '',
    }
  },
  methods: {
    showOrHide() {
      this.isShow = !this.isShow;
    }
  }
}
</script>

<template>
  <div>
<!--    使用动画-->
    <button @click="showOrHide">显示/隐藏</button>
    <transition name="h1Show" appear>
      <h1 v-show="isShow" >HELLO,WORLD</h1>
    </transition>
  </div>
</template>

<style scoped>
h1 {
  color: white;
  background-color: darkblue;
  text-align: center;
}

.v-enter-active {
  animation: show 1s linear;
}
/*默认transition*/
.v-leave-active {
  animation: show 1s linear reverse;
}
/* 给transition命名 h1Show */
.h1Show-enter-active {
  animation: show 0.5s linear;
}

.h1Show-leave-active {
  animation: show 0.5s linear reverse;
}

@keyframes show {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0%);
  }
}
@media screen {
  
}
</style>